import request from '#/utils/requestAbort';
import { SERVER_URL_OBJ } from '@/../config/urlConfig';

export async function queryContractOptions(params) {
  return request('/disclosure/contract-analysis/stationRelatedContract', {
    method: 'POST',
    data: params,
  });
}

export async function queryUnitOptions(params) {
  return request('/generation-common/correlaNodeStationConfig/queryProvinceList', {
    method: 'POST',
    data: params,
  });
}

export async function queryContractPriceFluctuationData(params) {
  const { order, param } = params;
  return request('/generation-common/flexible-aggregation/flexibleAggregation', {
    method: 'POST',
    data: {
      cacheable: true,
      needTotal: true,
      operators: {
        income: 'sum',
        quantity: 'sum',
        price: 'income / quantity',
      },
      order,
      param,
      url: `${
        SERVER_URL_OBJ[`${CLIENT_ENV === 'dev' ? 'test' : CLIENT_ENV}` || 'relpase']
      }/reanalyze/contract-analysis/contractPriceFluctuationData`,
    },
  });
}
export async function queryContractAndStationInfo(params) {
  return request('/disclosure/contract-analysis/contractAndStationInfo', {
    method: 'POST',
    data: params,
  });
}
